package com.szr.leex.po.base;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import javax.persistence.Version;

import com.szr.leex.po.id.StringIdentityEntity;

import lombok.Data;

/**
 * base status entity
 * Created by WangChen on 2018/9/12 10:53.
 */
@Data
@MappedSuperclass
public abstract class StatusEntity extends StringIdentityEntity {

    // Boolean类型的变量，如果不赋值，默认是null，查询条件为 WHERE used is null
    // Boolean是包装类型(Wrapper Type)，初始值为null
    // 包装类型是引用类型(Reference Type)。除了基本类型以外的，都是引用类型。
    private Boolean valid = true; // 是否可用

    @org.hibernate.annotations.Type(type = "yes_no")
    @Column(nullable = false)
    private Boolean deleted = false; // 是否删除

    //optimistic locking
    @Version
    private long version;

}
